﻿using RndMaterialDisposalService.Attrbutes;
using RndMaterialDisposalService.Services.Interface;
using Coravel.Invocable;

namespace RndMaterialDisposalService.Services.Coravel
{
    /// <summary>
    /// 每周六2点
    /// </summary>
    [CoravelJob("0 2 ? * 7")]
    public class SyncEDPAssetInfoJob : IInvocable
    {
        private readonly ILogger logger;
        private readonly IERPAssetInfoService assetInfoService;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="_logger"></param>
        /// <param name="_assetInfoService"></param>
        public SyncEDPAssetInfoJob(ILogger<SyncEDPAssetInfoJob> _logger,IERPAssetInfoService _assetInfoService)
        {
            logger = _logger;
            assetInfoService = _assetInfoService;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public async Task Invoke()
        {
            logger.LogInformation("SyncEDPAssetInfoJob Start..");
            await assetInfoService.SyncERPAssetData();
        }
    }
}
